package com.wang.response;


import com.sun.org.apache.bcel.internal.generic.NEW;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("分页列表返回类")
public class PageResult<T> implements Serializable {
    @ApiModelProperty("总数")
    private Long total;//总数
    @ApiModelProperty("记录集")
    private List<T> records;//记录集
    private Integer code;

    public static PageResult SUCCESS(Long total, List records, Integer code){
        PageResult tPageResult = new PageResult<>();
        tPageResult.setCode(200);
        tPageResult.setTotal(total);
        tPageResult.setRecords(records);
        return tPageResult;
    }



}
